package alan.sample;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.google.gson.Gson;
import com.hyty.cordova.plugins.MultiMediaPlugin;
import com.hyty.cordova.plugins.bean.Config;
import com.hyty.cordova.plugins.bean.PreviewDataBean;

import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.bt_1).setOnClickListener(v -> {
            try {
                List<PreviewDataBean> l = new ArrayList<>();
                PreviewDataBean mBean = new PreviewDataBean("IMG_20171218_154027.jpg");
                PreviewDataBean mBean2 = new PreviewDataBean("IMG_20171218_153616.jpg");
                PreviewDataBean mBean3 = new PreviewDataBean("IMG_20171218_153612.jpg");
                PreviewDataBean mBean4 = new PreviewDataBean("IMG_20171218_153608.jpg");
                l.add(mBean);
                l.add(mBean2);
                l.add(mBean3);
                l.add(mBean4);

//                String comfig = new Gson().toJson(new Config(1,"a_sample",l,true));
                String comfig = new Gson().toJson(new Config(1, "a_sample", "水印什么的都弱爆啦啦啦啦啦啦啦啦"));
                MultiMediaPlugin.getInstance(this).execute("", comfig, null);
            } catch (JSONException mE) {
                mE.printStackTrace();
            }
        });

    }
}
